<style lang="scss" scoped>
#main-header {
  width: 100%;
  .main-header {
    width: 100%;
    height: 68px;
    line-height: 68px;
    background: #2b3245;
    .main_left {
      float: left;
      img {
        margin: 6px 0;
      }
    }
    .main_right {
      float: right;
      margin-right: 20px;
      span {
        margin-right: 15px;
        color: #ebeef5;
        font-size: 14px;
      }
      .right-menu {
        font-size: 20px;
        &.cursor{
          cursor: pointer;
        }
      }
    }
  }
}
</style>

<template>
    <div id="main-header">
        <div class="main-header">
           <div class = "main_left">
                <img src="/static/images/home/logo2.png" />
           </div>
            <div class = "main_right">
                  <span class="right-menu cursor" @click="goCongenica">
                   <Icon type="upload" title="congenica上传"></Icon>
                </span>  
                <span class="right-menu">
                    <Icon type="android-person"></Icon>
                </span>
                <Poptip class="right-menu cursor" placement="bottom">
                    <span class="right-text">{{currentUser}}</span>
                      <div slot="title">
                        <a>账户信息</a>
                    </div>
                    <div slot="content">
                        <a>修改密码</a>
                    </div>
                </Poptip>
                <span @click="goHome" title="首页" style="padding-top:5px;cursor:pointer;" class="home-icon"><Icon size="20" color="#fff" type="android-home"></Icon></span>
                <span title="退出" @click="getBack" class="right-menu cursor">
                    <Icon type="android-exit"></Icon>
                </span>
            </div>
        </div>
    </div>
      
</template>
<script>
import { setCookie, getCookie, delCookie } from "@/common/js/cookie.js";
export default {
  name: "main-header",
  data() {
    return {
      currentUser: ""
    };
  },
  methods: {
    goHome() {
      this.$router.push("/home");
    },
    goCongenica(){
        this.$store.state.productId = '5';
        delCookie('productId')
        delCookie('currentSys')
        setCookie('productId', '5', null)
        var name = "congenica上传";
        setCookie('currentSys', name, null)
        this.$store.state.currentSys = "congenica上传";
        this.$router.push("/congenica");
    },
    getBack(){
      this.$store.state.userid = '';
      this.$store.state.username = '';
      delCookie('userid');
      this.$router.push("/home");
    }
  },
  created() {
    this.$store.state.username = getCookie("username");
    this.currentUser = this.$store.state.username;
  }
};
</script>
